package com.future.controller;

import com.future.domain.Result;
import com.future.service.ChatRoomService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "聊天室管理")
@RestController
public class ChatRoomController {
    @Autowired
    private ChatRoomService roomService;
    /**
     * 创建私聊
     * @param userId 要私聊对象的id
     * @return
     */
    @PostMapping("/insertPrivateChat")
    Result insertChatRoom(@RequestParam("userId") String userId) {
        return roomService.getOrCreatePrivateChatRoom(userId);
    }
    /**
     * 获取用户加入的所有聊天室
     * @return 聊天室列表
     */
    @GetMapping("/user-rooms")
    @ApiOperation("获取用户加入的所有聊天室")
    public Result getUserChatRoom() {
        return roomService.getUserChatRoom();
    }
    /**
     * 获取医生列表，用于选择医生进行心理咨询
     */
    @GetMapping("/DoctorList")
    public Result getDoctorList(@RequestParam("pageNum")Integer pageNum,@RequestParam("pageSize")Integer pageSize)
    {
        return roomService.DoctorsList(pageNum,pageSize);
    }
    /**
     * 创建或获取心理咨询室
     */
    @PostMapping("/creatCounselingroom")
    public Result creatCounselingroom(@RequestParam String userId)
    {
        return roomService.creatCounselingroom(userId);
    }
    @GetMapping("/classList")
    @ApiOperation("获取当前登录老师管理的班级列表")
    public Result getclassList()
    {
        return roomService.classList();
    }
}
